<?php
setlocale(LC_ALL, 'zh_CN.utf-8');
header("Content-Type:text/html;charset=utf-8");

require_once 'class/material.class.php';


$materialClass= new materialClass();

$total=$materialClass->getCount();




$data["total"] = $total;  

$items = $materialClass->getAll();


$items2=array();

foreach ($items as $key => $item) {
	$item2=array();

	$item2['id']=$item['id'];
	$item2['media_id']=$item['media_id'];
	$item2['cate']=$item['cate'];
	$item2['top']=$item['top'];
	$item2['author']=$item['author'];
	$item2['title']=$item['title'];
	$item2['digest']=$item['digest'];

	$updateTime=date('Y-m-d H:i:s',$item['update_time']); 
	$item2['update_time']=$updateTime;

	//$date3=date('Y-m-d H:i:s',"1228348800");
	
	array_push($items2, $item2);

}


$data["rows"] = $items;   
$json= json_encode($items2); 
echo $json; 
?>